﻿@using System.Diagnostics
@inherits BaseSearch<TraceLevel>

<CascadingValue Value="this">
    <BaseSearch Values="@Values"
                  Immediate="true"
                  Filter="@OnFilter"
                  ValueChanged="@ValueChanged">
    </BaseSearch>
</CascadingValue>
@code {
    [Parameter]
    public RenderFragment? ChildContent { get; set; }

    protected override void OnInitialized()
    {
        Values = Enum.GetValues<TraceLevel>();
    }

    private IEnumerable<TraceLevel> OnFilter(
        IEnumerable<TraceLevel> values,
        string filter)
    {
        return values.Where(w => w.ToString().ToLower().Contains(filter));
    }
}